package com.big.patient.controller;

import com.big.common.result.Result;
import com.big.model.model.patient.PatientInfo;
import com.big.model.vo.patient.PatientVo;
import com.big.patient.service.PatientService;
import io.swagger.annotations.ApiModelProperty;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/api/patient")
public class PatientController {

    @Autowired
    PatientService patientService;


    //添加用户
    @ApiModelProperty(value = "添加用户")
    @PostMapping("/savePatient")
    public Result savePatient(@RequestBody  PatientVo patientVo){
        patientService.savePatient(patientVo);
        return Result.ok();
    }


    //查找用户
    @ApiModelProperty(value = "查找用户")
    @GetMapping("/findUserPhone/{phone}")
    public PatientInfo FindPatient(@PathVariable("phone") String  phone){
        PatientInfo userInfo = patientService.findUserInfo(phone);
        return userInfo;
    }

    @ApiModelProperty(value = "查找用户")
    @GetMapping("/findUserById/{uId}")
    public PatientInfo findUserById(@PathVariable("uId") String  uId){
        PatientInfo userInfo = patientService.findUserInfoById(uId);
        return userInfo;
    }

}
